{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1411
  Verdict: Accepted
}
uses SysUtils;
 
var
	i,n,ans,p:longint;
	a:array[-10..10010] of longint;
	b:boolean;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
for i:=1 to n do 
	read(a[i]);
ans:=0;
repeat
	b:= true;
  for i:= 1 to n-1 do
   if a[i] > a[i+1] then
    begin
     p:= a[i];
     a[i]:= a[i+1];
		 a[i+1]:= p;
		 b:= false;
		 inc(ans);
		end;
 until b;
 write(ans);
end.